import 'package:flutter/material.dart';
import 'package:itoken/Components/CStore.dart';
import 'package:itoken/Pages/PHome.dart';
import 'package:itoken/Pages/PMain.dart';
import 'Components/CRouter.dart';
import 'Store/SAddress.dart';

void main() => runApp(
      IStore(
        providers: [
          ChangeNotifierProvider(create: (_) => SAddress()),
        ],
        builder: (BuildContext context) {
          return MyApp();
        },
      ),
    );

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    SAddress saddress = Provider.of<SAddress>(context);
    return MaterialApp(
      title: 'Flutter Demo',
      navigatorKey: navigator,
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: saddress.isAddress ? PMain() : PHome(),
    );
  }
}

// class _MyClipper extends CustomClipper<Path> {
//   final double height;
//   _MyClipper({
//     @required this.height,
//   });

//   @override
//   Path getClip(Size size) {
//     // double height = 120;
//     print(height);
//     Path path = Path()
//       ..lineTo(0, 0)
//       ..lineTo(size.width / 2 - 120, 0)
//       ..cubicTo(
//         size.width / 2 - 90,
//         height * 0.05,
//         size.width / 2 - 80,
//         height,
//         size.width / 2,
//         height,
//       )
//       ..cubicTo(
//         size.width / 2 + 80,
//         height,
//         size.width / 2 + 90,
//         height * 0.05,
//         size.width / 2 + 120,
//         0,
//       )
//       ..lineTo(size.width, 0)
//       ..lineTo(size.width, size.height)
//       ..lineTo(0, size.height);

//     return path;
//   }

//   @override
//   bool shouldReclip(CustomClipper<Path> oldClipper) => false;
// }
